/*
https://leetcode.cn/problems/min-cost-climbing-stairs/submissions/584685294/?envType=problem-list-v2&envId=dynamic-programming
746. 使用最小花费爬楼梯
*/
class Solution {
    int f[1010];
public:
    int minCostClimbingStairs(vector<int>& cost) {
f[0]=f[1]=0;
int n=cost.size();
for(int i=2;i<=n;++i){
    f[i]=min(f[i-1]+cost[i-1],f[i-2]+cost[i-2]);
}
return f[n];
    }
};